import table from '@/components/dt/table/render.js'
import Opt from '@/components/dt/info/Opt.js'

let _this = null;

class Columns extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
    {
      title: '打法归属',
      field: 'customerSourceName',
      minWidth: 120,
    },
    {
      title: '打法名称 ',
      field: 'planName',
      minWidth: 120,
    },
    {
      title: '关联渠道数 ',
      field: 'channelCount',
      minWidth: 110,
      cell: (info) => {
        return {
          btn: {
            title: info.channelCount,
            event: 'relevancyNum'
          }
        }
      }
    },
    {
      title: '操作时间',
      field: 'updateTime',
      minWidth: 180,
    },
    {
      title: '操作人',
      field: 'updateUser',
      minWidth: 120,
    }, {
      title: '操作',
      minWidth: 100,
      slots: {
        default: (params, h) => {
          let btns = []
          btns.push({
            title: '关联渠道',
            event: 'relevancyHandel',
            data: params.row
          })
          return table.cell.btns(_this, h, btns)
        }
      }
    }]
  }

}
export default Columns